package com.example.indenture.message.dao;

import com.example.indenture.common.vo.Search;
import com.example.indenture.message.entity.Message;
import com.example.indenture.team.entity.Team;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author gzp
 * @create 2023-02-22 10:28
 */
@Repository
@Mapper
public interface MessageDao {

    @Insert("insert into message(uid, create_date, update_time,rid,des,pre) " +
            "values(#{uid}, #{createDate}, #{updateTime},#{rid}, #{des}, #{pre})")
    @Options(useGeneratedKeys = true, keyProperty = "id", keyColumn = "id")
    void insert(Message message);

    //根据比赛id和队伍名字查找队伍
    @Select(("select * from message where rid=#{rid}"))
    List<Message> selectMessage(int rid);

    @Select(("select * from message where id=#{mid}"))
    Message getMessageById(int mid);
}
